home *** CD-ROM | disk | FTP | other *** search
- unit RAMU;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- StdCtrls;
-
- type
- TForm1 = class(TForm)
- Label1: TLabel;
- Label2: TLabel;
- procedure FormCreate(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- uses
- QTThunkU;
-
- var
- DLLHandle: THandle16;
-
- const
- //To access a CMOS data value, write its address
- //into port $70 and read its value from port $71
- CMOSSelector = $70;
- CMOSData = $71;
- BaseMemLo = $15;
- BaseMemHi = $16;
- ExtMemLo = $17;
- ExtMemHi = $18;
-
- procedure TForm1.FormCreate(Sender: TObject);
- var
- BaseRAMAmount, ExtRAMAmount: Word;
- begin
- Call16BitRoutine('WritePort', DllHandle, ccPascal,
- [CMOSSelector, BaseMemLo], [SizeOf(Word), SizeOf(Byte)]);
- WordRec(BaseRAMAmount).Lo := Call16BitRoutine('ReadPort',
- DllHandle, ccPascal, [CMosData], [SizeOf(Byte)]);
- Call16BitRoutine('WritePort', DllHandle, ccPascal,
- [CMOSSelector, BaseMemHi], [SizeOf(Word), SizeOf(Byte)]);
- WordRec(BaseRAMAmount).Hi := Call16BitRoutine('ReadPort',
- DllHandle, ccPascal, [CMosData], [SizeOf(Byte)]);
-
- Call16BitRoutine('WritePort', DllHandle, ccPascal,
- [CMOSSelector, ExtMemLo], [SizeOf(Word), SizeOf(Byte)]);
- WordRec(ExtRAMAmount).Lo := Call16BitRoutine('ReadPort',
- DllHandle, ccPascal, [CMosData], [SizeOf(Byte)]);
- Call16BitRoutine('WritePort', DllHandle, ccPascal,
- [CMOSSelector, ExtMemHi], [SizeOf(Word), SizeOf(Byte)]);
- WordRec(ExtRAMAmount).Hi := Call16BitRoutine('ReadPort',
- DllHandle, ccPascal, [CMosData], [SizeOf(Byte)]);
-
- Label2.Caption := Format('%dkb base, %.0nkb extended',
- // Turn extended memory integer value into a float so we
- // can use %n and get it nicely formatted with commas
- [BaseRAMAmount, ExtRAMAmount * 1.0]);
- end;
-
- initialization
- DLLHandle := LoadLib16('Ports.DLL');
- finalization
- FreeLibrary16(DllHandle);
- end.
-